<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link href="../css/style.css" rel="stylesheet" />
		<script src="../../js/mui.min.js"></script>
	</head>
	<body>
		<script type="text/javascript">
			
			mui.init();
			window.addEventListener('refresh', function(e){//执行刷新
			  location.reload(); 
			  });
			
		</script>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">个人中心</h1>
		</header>
<!--		<div id="mengban"  style="left: 0;right:0;top:0;bottom:0;opacity:0.5;height:100%;text-align:center;color:#FAFAFA;position: fixed;background: #555555;z-index: 100; display: block;"><a href="../login.html"><h2 style="margin-top: 200px;">请先登陆</h2></a></div>-->
		<div class="mui-content">
			<ul class="mui-table-view" >
			    <li class="mui-table-view-cell mui-media" id="setting">
			        <a href="javascript:;">
			            <img id="headimg" class="mui-pull-left" style="width: 60px; height: 60px;" src="../../images/logo.png" onerror="this.onerror=null;this.src='../../images/logo.png'">
			            <div class="mui-media-body" style="margin-left: 100px;">
			                <div style="line-height:30px;">用户名:<span id='username'></span><br><p  id="authenticate">未实名认证</p></div>
			            </div>
			        </a>
			    </li>
	 <li class="mui-table-view-cell  admin-li-span"onclick="goto('news','user','list','')">
					<a class="mui-navigate-right" href="#">
						他的资讯<span class="mui-badge mui-badge-inverted">更多</span>
					</a>
					
	</li>
	<li id="news"></li>
 	
</ul>
</div>
<script src="../../js/app.js"></script>
<script type="text/javascript">

info();
var	p= 0;
function info(){//我的微博帖
			apptoken['act']= 'info';
			apptoken['tid']= tid;
			 mui.post(home.hos+'/user/user',apptoken,function(data){
//			 alert(data);
			var result=JSON.parse(data);
//			if(result.authenticate)
			switch(result.authenticate){
			case 1:
			  authenticate='<span class="mui-badge" style="background:#9AFF9A;color:#CD00CD">个人</span>';
			  break;
			case 2:
			  authenticate='<span class="mui-badge" style="background:#EEB422;color:#CD00CD">企业</span>';
			  break;
			default:
			  authenticate='<span class="mui-badge">未认证</span>';
			}
document.getElementById("username").innerHTML=result.username;
document.getElementById("authenticate").innerHTML=authenticate;
document.getElementById("headimg").src=home.uploads+'/img/user/'+result.headimg;
			},'text');
}
news(0);
function news(num){//我的微博帖
				if(num==1){p=p+1}else{p=0;document.getElementById("news").innerHTML='';};
			apptoken['p']= p;
			apptoken['act']= 'userlist';
			 mui.post(home.hos+'/news/user',apptoken,function(data){
//			 alert(data);
			var result=JSON.parse(data);
			 var val='';
			 var pic='';
		for(var i=0;i<result.length;i++){
			if(result[i].pic===null || result[i].pic==='' || result[i].pic==='undefined'){
				pic='';
			}else{
			pd=result[i].pic.indexOf(",")==-1;//判断字符串里是否含有逗号如果不含有
			if(pd!=-1){
				var rpic=result[i].pic.split(",");
				pic='<img class="mui-media-object mui-pull-left" style="margin-right:10px" src="'+home.uploads+'/img/news/cut'+rpic[0]+'" onerror="this.onerror=null;this.src=\''+home.uploads+'/img/news/min'+rpic[0]+'\'" />';}
			}
			liststyle(result[i].id,getFormatCodec(result[i].content.substr(0,38)),result[i].refresh,pic,result[i].comment,result[i].collect,result[i].zan,result[i].relationoff);
			}
				//服务器返回响应，根据响应结果，分析是否登录成功；
			},'text');
}
function  liststyle(tid,contents,refreshtime,pic,comment,collect,zan,relationoff){
			var retime=new Date(parseInt(refreshtime) * 1000).format('yyyy-MM-dd hh:mm:ss');
	document.getElementById("news").innerHTML+='<div id="list'+tid+'" ><li class="mui-table-view-cell mui-media"><div class="mui-media-body" id="'+tid+'" onclick="goto(\'news\',\'home\',\'detail\','+tid+')" >'+pic+contents+'<p class="mui-ellipsis">'+retime+'</p></div></div></li>';
}
</script>
	</body>
</html>